package us.icitap.cm.utils.convertes;

import java.util.List;
import java.util.Set;

import com.vaadin.data.util.converter.Converter;
import com.vaadin.data.util.converter.DefaultConverterFactory;

public class MyConverterFactory extends DefaultConverterFactory{

	@Override
    public <PRESENTATION, MODEL> Converter<PRESENTATION, MODEL>
            createConverter(Class<PRESENTATION> presentationType,
                            Class<MODEL> modelType) {
        // Handle one particular type conversion
        if (Set.class == presentationType &&
            List.class == modelType)
            return (Converter<PRESENTATION, MODEL>)
                   new MyListToSetConverter();

        // Default to the supertype
        return super.createConverter(presentationType,
                                     modelType);
    }
}
